version: '3.8'

services:
  web:
    build: ./web/
    ports:
      - 8080:8080
    volumes:
      - ./web:/usr/src/app/web
    command: air ./app/main.go -b 0.0.0.0

  orchestrator:
    build: ./orchestrator
    ports:
      - 8081:8081
    volumes:
      - ./orchestrator:/usr/src/app/orchestrator
    command: air ./main.go -b 0.0.0.0

  calculator:
    build: ./calculator
    ports:
      - 8085:8085
    volumes:
      - ./calculator:/usr/src/app/calculator
    command: air ./main.go -b 0.0.0.0

  db:
    image: postgres:alpine
    env_file:
      - .env
    environment: 
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=${DB_NAME}
    ports:
      - 5432:5432
    volumes:
      - postgres-db:/usr/src/app/postgresql/data

volumes:
  postgres-db:
